package com.gui.ssm.controller;

import com.gui.ssm.entity.ResponseResult;
import com.gui.ssm.entity.User;
import com.gui.ssm.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("/user")
public class UserController {
    @Autowired
    private IUserService userService;

    @RequestMapping(value = "/handle_login.do", method = RequestMethod.POST)
    @ResponseBody
    public ResponseResult<Void> handleLogin(User user){
      userService.login(user);
        return new ResponseResult<Void>();
    }

    @RequestMapping(value = "/handle_reg.do", method = RequestMethod.GET)
    @ResponseBody
    public ResponseResult<Void> addUser(User user){
        userService.add(user);
        return new ResponseResult<Void>();
    }

}
